namespace IAM.Interface.Model
{
    using IAM.Interface.Common;
    using IAM.Interface.Model.Interface;
    using System;
    using System.Reflection;
    using System.Text;

    public class DimensionLevel : AbstractConvertObject, IConvertXml
    {
        private string _display = "";
        private string _id = "";

        public override object ConvertToObject()
        {
            this.ID = EnDeCoding.Decode(this.CurrentXmlNode.Attributes["ID"].InnerText);
            this.Display = EnDeCoding.Decode(this.CurrentXmlNode.Attributes["Display"].InnerText);
            return this;
        }

        public override bool Equals(object obj)
        {
            DimensionLevel dl = null;
            try
            {
                dl = (DimensionLevel) obj;
            }
            catch
            {
                return false;
            }
            bool result = true;
            if (this.ID != dl.ID)
            {
                result = false;
            }
            else if (this.Display != dl.Display)
            {
                result = false;
            }
            return result;
        }

        public override int GetHashCode()
        {
            int result = 1;
            foreach (PropertyInfo onofpi in base.GetType().GetProperties())
            {
                result += onofpi.GetHashCode();
            }
            return result;
        }

        public string Display
        {
            get
            {
                return this._display;
            }
            set
            {
                this._display = value;
            }
        }

        public string ID
        {
            get
            {
                return this._id;
            }
            set
            {
                this._id = value;
            }
        }

        public string XML
        {
            get
            {
                return (this.XMLBoday + this.XMLFinis);
            }
        }

        public string XMLBoday
        {
            get
            {
                StringBuilder _xml = new StringBuilder();
                _xml.Append("<DimensionLevel");
                _xml.Append(" ID=\"" + EnDeCoding.Encode(this.ID) + "\"");
                _xml.Append(" Display=\"" + EnDeCoding.Encode(this.Display) + "\"");
                _xml.Append(" />");
                return _xml.ToString();
            }
        }

        public string XMLFinis
        {
            get
            {
                return "";
            }
        }
    }
}

